package com.example.tests;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;

import org.testng.annotations.Test;

import com.example.fw.FolderHelper;

public class TestFolderDelete extends TestBase{

	@Test
	public void testDelete() throws InterruptedException{
		String folder = FolderHelper.generateRandomFolderName();

		Folders oldFolders = app.getFolderHelper().getFolders();
		assertThat(app.getFolderHelper().createFolder(folder), is(nullValue()));
		Folders newFolders = app.getFolderHelper().getFolders();
		assertThat(newFolders, equalTo(oldFolders.withAdded(folder)));
		
		app.getFolderHelper().deleteFolder(folder);
		Folders newFoldersAfterDelete = app.getFolderHelper().getFolders();
		assertThat(oldFolders, equalTo(newFoldersAfterDelete));
	}
}
